package main

func majorityElement(nums []int) []int {
    m := map[int]int{}
	var result []int
	for _, n := range nums {
		m[n]++
	}
	threshold := len(nums)/3
	for k, v := range m {
		if v > threshold {
			result = append(result, k)
		}
	}
	return result
}